import React, { FC } from "react"
import { Loading } from "@taroify/core"
import type { LoadingProps } from "@taroify/core/loading/index"
import { View } from "@tarojs/components"
import clsx from "clsx"
import styles from "./index.module.scss"

type IProps = {
  className?: string
  loadingProps?: LoadingProps
}
/** 页面上划加载时的loading */
const GpScrollLoading: FC<IProps> = ({ className, loadingProps = {} }) => {
  if (loadingProps.className) {
    loadingProps.className = styles["custom-loading"] + loadingProps.className
  } else {
    loadingProps.className = styles["custom-loading"]
  }
  return (
    <View className={clsx("flex items-center justify-center py-16px", className)}>
      <Loading {...loadingProps} />
    </View>
  )
}
export default GpScrollLoading
